<template>
	<div>
		<van-col span="24">
			<h1>虹映</h1>
			<h5>一款可以学习的视频播放平台</h5>
			<van-image
					round
					width="5rem"
					height="5rem"
					src="https://img01.yzcdn.cn/vant/cat.jpeg"
			/>

		<van-form @submit="onSubmit" style="margin-top: 20px">
			<van-field
					v-model="user.phone"
					name="用户名"
					label="用户名"
					placeholder="用户名"
					:rules="[{ required: true, message: '请填写用户名' }]"
			/>
			<van-field
					v-model="user.pass"
					type="password"
					name="密码"
					label="密码"
					placeholder="密码"
					:rules="[{ required: true, message: '请填写密码' }]"
			/>
			<van-field
					v-model="user.ensurePass"
					type="password"
					name="确认密码"
					label="确认密码"
					placeholder="请确认密码"
					:rules="[{ required: true, message: '请再次填写密码' }]"
			/>
			<div style="margin: 16px;">
				<van-button round block type="info" native-type="submit">提交</van-button>
			</div>
		</van-form>
		</van-col>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				user:{
					phone: '',
					pass: '',
					ensurePass:''
				}
			};
		},
		methods: {
			onSubmit() {
				const _this=this;
				if(this.user.pass==this.user.ensurePass){
					this.axios.post("http://10.8.153.37:8081/api/user/add.do",{
						phone:this.user.phone,
						pass:this.user.pass
					}).then(function (res) {
						if(res.data.code==10000){
							_this.$router("/index")
						}else {

						}
					})
				}else {
					this.$toast("两次输入密码不一致请重试")
				}
			},
		},
	};
</script>

<style>
</style>
